$(function(){

    selectjob();
	$(".yess").click(function(){
		selectjob();
	});
});

function selectjob(){
	// 首次加载所有数据
	var url = "/jobOffersSelectServiceService/getAllJobOffersSelectServcie";//路径
    var optival = $("#select option:selected").val();//获取选中筛选条件
	// alert(optival);
	var data = {"jobStatus":optival};//传递参数
	$(".main_info").empty();//删除选中元素的子元素
	$.getJSON(url,data,function(data){
		$(data).each(function(){
			var $div = $("<div class='info_row row'>"+
			"<div class='row_left col-md-4'>"+
			"<div class='row_left_row1 row'>"+
			"<h4 class='col-md-6'>"+this.jobOffers.jobName+"</h4>"+
			"<h5 class='col-md-5 text-left'>"+this.jobOffers.startSalaryRange+"-"+this.jobOffers.endSalaryRange+"k·"+this.jobOffers.payroll+"薪</h5>"+
			"</div>"+
			"<div class='row_left_row2 row'>"+
			"<ul>"+
			"<li>"+addres(this.jobOffers.cityClassifyId)+"</li>"+
			"<li>"+this.jobOffers.workExperienceName+"</li>"+
			"<li>"+this.jobOffers.educationName+"</li>"+
			"</ul></div></div>"+
			"<div class='middle col-md-4'>"+
			"<div class='middle_row1 row'>"+
			"<h4 class='col-md-12'>"+this.fullCompanName+"</h4>"+
			"</div>"+
			"<div class='middle_row2 row'>"+
			"<ul>"+
			"<li>"+this.industryCategoryName+"</li>"+
			"<li>"+this.financngStageName+"</li>"+
			"<li>"+this.aompanySizeName+"</li>"+
			"</ul></div></div>"+
			"<div class='right col-md-4'>"+
			"<div class='right_row1 row'>"+
			"<div class='col-md-5 right_row1_left1'>"+
			"<div class='right_row1_left1>img'>"+
			// "<img src='../static/zysstatic/boosAfterBlock/img/logo/logo.pn'/>"+
			"</div>"+
			"<h6>"+this.jobOffers.bossName+"</h6>"+
			"</div>"+
			"<div class='col-md-6 right_row1_right1'>"+
			"<h6>"+this.companyProfile+"</h6>"+
				"</div> </div> </div> </div>");
			$(".main_info").append($div);
			var $h6s = $(".right_row1_right1 h6");
			$h6s.text(($h6s.text().substr(0,8)+"..."));
		});
	});
// alert(addres(1));
}

//返回工作城市
function addres(datas){
	$.ajaxSettings.async = false;
	var url = "/addressClassify/getAddressClassifyById";//路径
	var data = {"addressClassifyId1":datas};//传递参数
	var $li = null;//城市名称
	$.getJSON(url,data,function(data){
		$(data).each(function(){
			if(this.addressClassifyName2 != null){
				$li = this.addressClassifyName2 + "&nbsp;";
			}
			if(this.addressClassifyName1 != null) {
				$li = this.addressClassifyName2 + "&nbsp;" + this.addressClassifyName1+ "&nbsp;";
			}
			if(this.addressClassifyName != null){
				$li = this.addressClassifyName1+ "&nbsp;"+ this.addressClassifyName;
			}

		})
	});
	$.ajaxSettings.async = true;
    return $li;
}